//// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
//// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
//// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
//// PARTICULAR PURPOSE.
////
//// Copyright (c) Microsoft Corporation. All rights reserved

#pragma once

#include <xaudio2.h>

// Audio:
// This class uses XAudio2 to provide sound output.  It creates two
// engines - one for music and the other for sound effects - each as
// a separate mastering voice.
// The SuspendAudio and ResumeAudio methods can be used to stop
// and start all audio playback.

ref class Audio
{
internal:
   Audio();

   void Initialize();
   void CreateDeviceIndependentResources();
   IXAudio2 *MusicEngine();
   IXAudio2 *SoundEffectEngine();
   void SuspendAudio();
   void ResumeAudio();

   protected private:
   bool m_audioAvailable;
   Microsoft::WRL::ComPtr<IXAudio2> m_musicEngine;
   Microsoft::WRL::ComPtr<IXAudio2> m_soundEffectEngine;
   IXAudio2MasteringVoice           *m_musicMasteringVoice;
   IXAudio2MasteringVoice           *m_soundEffectMasteringVoice;
};
